package sfeir.ergosum.model;

import java.io.Serializable;
import java.util.Date;

/**
 * A contact is the link between a person and a group and allow the user to set
 * an alias.
 * 
 * @author weber.a
 * 
 */
public class Contact implements Serializable {

    private static final long serialVersionUID = -3329287820986836897L;
    private long _id;
    private String url;
    private String alias;
    private long groupId;

    private long updated;

    private long phoneId;

    private long letterId = -1;
    private long phoneIndex = -1;
    private long mailIndex = -1;

    private long fnletter = -1;
    private long fnphone = -1;
    private long fnmail = -1;

    private long access = 0;

    private Person person;

    public Contact() {
        super();
        this.updated = new Date().getTime();
    }

    public Contact(String url) {
        super();
        this.url = url;
        this.updated = new Date().getTime();
    }

    public Contact(String alias, String url) {
        super();
        this.url = url;
        this.alias = alias == null ? alias : alias.trim();
        this.updated = new Date().getTime();
    }

    public Contact(int id, String url, String alias, Person person) {
        super();
        this._id = id;
        this.url = url;
        this.alias = alias == null ? alias : alias.trim();
        ;
        this.person = person;
        this.updated = new Date().getTime();
    }

    public Person getPerson() {
        return person;
    }

    public void setPerson(Person person) {
        this.person = person;
    }

    public long getId() {
        return _id;
    }

    public void setId(long id) {
        this._id = id;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getAlias() {
        return alias;
    }

    public void setAlias(String alias) {
        this.alias = alias == null ? alias : alias.trim();
        ;
    }

    public long getGroupId() {
        return groupId;
    }

    public void setGroupId(long groupId) {
        this.groupId = groupId;
    }

    public long getUpdated() {
        return updated;
    }

    public void setUpdated(long updated) {
        this.updated = updated;
    }

    public long getPhoneId() {
        return phoneId;
    }

    public void setPhoneId(long phoneId) {
        this.phoneId = phoneId;
    }

    public long getLetterId() {
        return letterId;
    }

    public void setLetterId(long letterId) {
        this.letterId = letterId;
    }

    public long getPhoneIndex() {
        return phoneIndex;
    }

    public void setPhoneIndex(long phoneIndex) {
        this.phoneIndex = phoneIndex;
    }

    public long getMailIndex() {
        return mailIndex;
    }

    public void setMailIndex(long mailIndex) {
        this.mailIndex = mailIndex;
    }

    public long getFnletter() {
        return fnletter;
    }

    public void setFnletter(long fnletter) {
        this.fnletter = fnletter;
    }

    public long getFnphone() {
        return fnphone;
    }

    public void setFnphone(long fnphone) {
        this.fnphone = fnphone;
    }

    public long getFnmail() {
        return fnmail;
    }

    public void setFnmail(long fnmail) {
        this.fnmail = fnmail;
    }

    public long getAccess() {
        return access;
    }

    public void setAccess(long access) {
        this.access = access;
    }

}
